import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { param } from '@/utils/index'

/**
 * 第三方店铺分页查询
 */
export function pagingThirdGoods(params) {
  return request({
    url: '/third/thirdGoods/pagingThirdGoods',
    method: 'get',
    params
  })
}

/**
 * 保存第三方商品信息
 */
export function saveThirdGoods(data) {
  return request({
    url: '/third/thirdGoods/saveThirdGoods',
    method: 'post',
    data: data
  })
}

// 导出可选商品
export function exportProjectGoods(entity) {
  return process.env.BASE_API + '/third/thirdGoods/exportProjectGoods?' + param(entity) + '&accessToken=' + getToken()
}

// 获取订单详情
export function doGetThirdGoodsById(thirdGoodsId) {
  return request({
    url: '/third/thirdGoods/getThirdGoodsById',
    method: 'post',
    params: thirdGoodsId
  })
}

// 获取运费模板列表
export function getFreightTemplate(platformType, shopId) {
  return request({
    url: '/third/thirdGoods/getFreightTemplate',
    method: 'post',
    params: { platformType, shopId }
  })
}

// 获取我的发货地址列表
export function getMySendAddress(platformType, shopId) {
  return request({
    url: '/third/thirdGoods/getMySendAddress',
    method: 'post',
    params: { platformType, shopId }
  })
}

// 获取类目属性
export function getCateProperty(platformType, shopId, thirdCategoryId) {
  return request({
    url: '/third/thirdGoods/getCateProperty',
    method: 'post',
    params: { platformType, shopId, thirdCategoryId }
  })
}
